package com.zisu.aradvertising.pojo;

public class Result<T> {
    private String m1;
    private String m2;
    private T data;

    public String getM1() {
        return m1;
    }

    public void setM1(String m1) {
        this.m1 = m1;
    }

    public String getM2() {
        return m2;
    }

    public void setM2(String m2) {
        this.m2 = m2;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Result() {
    }

    public Result(T data) {
        this.data = data;
    }

    public static Result success() {
        Result result = new Result<>();
        result.setM1("0");
        result.setM2("成功");
        return result;
    }

    public static <T> Result<T> success(T data) {
        Result<T> result = new Result<>(data);
        result.setM1("0");
        result.setM2("成功");
        return result;
    }

    public static <T> Result<T> success(T data, String msg) {
        Result<T> result = new Result<>(data);
        result.setM1("0");
        result.setM2(msg);
        return result;
    }
    public static <T> Result<T> success(T data, String msg, int i) {
        Result<T> result = new Result<>(data);
        result.setM1(String.valueOf(i));
        result.setM2(msg);
        return result;
    }
    public static Result error(String code, String msg) {
        Result result = new Result();
        result.setM1(code);
        result.setM2(msg);
        return result;
    }
}
